package day9;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class ArcadeText {
    public static void main(String[] args) {
        System.out.println("商场");
        Scanner in = new Scanner(System.in);
        Arcade arc = new Arcade();
        System.out.println("请输入商场名");
        arc.setArcadeName(in.next());
        System.out.println("请输入商场地址");
        arc.setAddress(in.next());
        int choice = 0;
        while (true){

            System.out.println("1:新增会员\n2:查看会员信息\n3：涨分\n4:兑换 \n9:退出");
            choice = in.nextInt();
            switch (choice){
                case 1:{
                    Huiyuan C = new Huiyuan();
                    System.out.println("请输入会员卡号");
                    C.setHYH(in.nextInt());
                    System.out.println("请输入会员姓名");
                    C.setUsername(in.next());
                    System.out.println("请输入会员手机号");
                    C.setPhone(in.next());
                    System.out.println("请输入会员积分");
                    C.setJF(in.nextInt());
                    boolean aa = arc.checkCardNoRepeat(C.getHYH());
                    if (aa){
                        System.out.println("该会员卡号已存在，不能增加");
                    }else {
                        if (arc.add(C)){
                            System.out.println("添加成功");
                        }else {
                            System.out.println("添加失败");
                        }
                    }
                }
                break;
                case 2:{
                    arc.show();
                }
                break;
                case 3:{
                    System.out.println("请输入会员卡号");
                    int HY = in.nextInt();
                    System.out.println("请输入要给它涨多少分（整数）");
                    int jf = in.nextInt();
                    if (arc.inc(HY,jf)){
                        System.out.println("涨分成功");
                    }else {
                        System.out.println("失败");
                    }
                }
                break;
                case 4:{
                    System.out.println("请输入要兑换物品人的卡号");
                    int kh = in.nextInt();
                    System.out.println("请输入你要兑换的物品 （文字） 可选下面某一个) \n 餐巾纸；\n 剃须刀；\n 炒锅一个；");
                    String wp = in.next();
                    String lipin=arc.duihuan(wp,kh);
                    System.out.println(lipin==null?"没有兑换成功":lipin);
//
                }
                break;
                case 9:{
                    return;
                }
            }
        }
    }
}